import { inject } from 'vue'

// 操作
export const baseHandler = () => {
  let viewer: any = null;
  let eventsManager: any = null;
  let widgetsManager: any = null;

  const getViewerInstance: any = inject('getViewerInstance')
  if (getViewerInstance) {
    viewer = getViewerInstance()

  }

  // 用来获取全局的事件发布订阅对象
  const getEventsManager: any = inject('getEventsManager')
  if (getEventsManager) {
    eventsManager = getEventsManager()

  }

  // 获取全局组件管理对象
  const getWidgetsManager: any = inject('getWidgetsManager')
  if (getWidgetsManager) {
    widgetsManager = getWidgetsManager()

  }

  return {
    viewer,
    eventsManager,
    widgetsManager
  }
}